package com.yangchao.webflux;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

public class chat04onclose {
    public static void main(String[] args) throws InterruptedException {
        List<Student2> students = new ArrayList<>();
        students.add(new Student2("张;三", 18));
        students.add(new Student2("李四", 19));
        students.add(new Student2("王五", 20));
        // 使用flatMap来处理包含分号的学生名字，拆分成多个学生对象
        Stream<Student2> onClose = students.stream().onClose(() -> System.out.println("onClose:"+Thread.currentThread().getName()));
        onClose.close();
    }
}
